from PIL import Image

def print_pixel_values(image_path):
    # 打开图像文件
    image = Image.open(image_path)

    # 获取图像的宽度和高度
    width, height = image.size

    # 遍历图像的每个像素，并打印其值
    for y in range(height):
        for x in range(width):
            # 获取当前像素的值
            pixel_value = image.getpixel((x, y))
            print(f"({x}, {y}): {pixel_value}")

# 指定图像文件路径
# image_path = "/media/jolly/HIK/CorsicanFire/CorsicanFire/label/predictResult/031_rgb.png"
image_path = "/media/jolly/HIK/CorsicanFire/BoFire/val/label1/fire033.png"

# 调用函数打印每个像素的值
print_pixel_values(image_path)